
<div class="container-fluid">
    <div class="row">
        <div class="panel panel-default">
            <div class="panel-body" style="margin-bottom: 0px;">
                <div class="form-inline" style="margin-bottom: 5px;">
                    <label>工号:</label>
                    <input id="user_id" style="width: 100px;" class="form-control">
                    &nbsp;&nbsp;
                    <label>姓名:</label>
                    <input id="user_name" style="width: 100px;" class="form-control">
                    &nbsp;&nbsp;
                    <button class="btn btn-default" onclick="$('#list-table').bootstrapTable('refresh');">
                        <span class="fa fa-search"></span>&nbsp;查询
                    </button>
                </div>
                <table id="list-table"></table>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        var h = $(window).height();
        $("#list-table").bootstrapTable({
            url:'getEmployeeList',
            method:'post',
            sidePagination: 'server',
            pagination:true,
            pageSize:10,
            pageList:[10,20,50],
            pageNumber:1,
            height:h - 100,
            columns:[{
                title:'工号',
                field:'STAFF_ID',
                sortable:true
            },{
                title:'姓名',
                field:'NAME',
                sortable:true
            },{
                title:'所在学院',
                field:'COLLEGE',
                sortable:true
            },{
                title:'操作',
                field:'STAFF_ID',
                halign:'center',
                align:'center',
                formatter:function (value,rowData,index) {
                    var html1 = "<button class='btn btn-xs btn-info' style='margin: 2px;' STAFF_ID='"+value+"' USER_NAME='"+rowData['NAME']+"' onclick='clickSelect(this)'>选择</button>"
                    return html1;
                }
            }],
            queryParams:function (params) {
                params.user_id = $('#user_id').val();
                params.user_name = $("#user_name").val();
                return params;
            },
            responseHandler:function (res) {
                // res = JSON.parse(res);
                console.log(res);
                return res;
            }
        });
    });

    function clickSelect(obj) {
        var staffId = $(obj).attr('STAFF_ID');
        var userName = $(obj).attr('USER_NAME');
        parent.selectUser(staffId,userName);
        parent.layer.closeAll();
    }

</script>